<div>
    <table class="table table-striped .table-hover">
        <thead>
        <tr>
            <th>序号</th>
            <th>实例ID</th>
            <th>申请人姓名</th>
            <th>开始时间</th>
            <th>结束时间</th>
            <th>天数</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody id="subAList-tbody">

        </tbody>
    </table>
</div>
<script>
    //经理操作页面
    function AFLeaveAgree1(id, proInstanceId){
        var data = {
            id: id,
            proInstanceId: proInstanceId,
            approverName: '经理001',
            approverResult: 1,
            approverRemark: '经理001同意'
        }
        $.ajax({
            type: 'post',
            url: '/api/v1/askForLeave/AFLeaveAgree',
            data: data,
            success: function(data) {
                if(data.code == "2000"){
                    alert("操作成功")
                    loadGrid()
                }else{
                    alert(data.message)
                }
            }
        });
    }
    function loadGrid(){
        $.ajax({
            type: 'get',
            url: '/api/v1/askForLeave/all',
            data: {queryType : "mangerApplyFor"},
            success: function(data) {
                if(data && data.code == "2000") {
                    var tbodyHtml = ""
                    var res = data.data
                    var index = 0;
                    var len = res.length;
                    for( ;index < len ; index++){
                        var el = res[index];
                        tbodyHtml += "<tr>"
                        tbodyHtml += "<th>"+el.id+"</th>";
                        tbodyHtml += "<th>"+el.proInstanceId+"</th>";
                        tbodyHtml += "<th>"+el.name+"</th>";
                        tbodyHtml += "<th>"+el.startDate+"</th>";
                        tbodyHtml += "<th>"+el.endDate+"</th>";
                        tbodyHtml += "<th>"+el.day+"</th>";
                        tbodyHtml += "<th>"+el.createDate+"</th>";
                        tbodyHtml += "<th>"+'<button onclick="AFLeaveAgree1('+el.id+','+el.proInstanceId+')" type="button" class="btn btn-success">同意</button>'+"</th>";
                        tbodyHtml += "</tr>";
                    }
                    $("#subAList-tbody").html(tbodyHtml)
                }
            }
        });
    }
    $(function(){
        //初始化表格
        loadGrid();
    })
</script>